<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // typeof 运算符
        // 1.识别所有值类型
        // 2.识别函数
        // 3.判断是否是引用类型
        // const arr = [1,2,3,4,5]
        // const sum =  arr.reduce((prev, cur, index) => {
        //     console.log(prev, cur, index)
        //     return prev + cur
        // })
        // console.log(sum)
        const person = [
            {name: 'lisi', age: 18},
            {name: 'zhans', age: 19},
            {name: 'www', age: 20},
            {name: 'www', age: 20},
        ]
        let sum = person.reduce((prev, cur, index) => {
            console.log(prev, cur, index)
            prev = prev + cur.age
            return prev
        }, 0)
        console.log(sum)
    </script>
</body>
</html>